#ifndef _SMP_TOOLBAR_H
#define _SMP_TOOLBAR_H

#include "sgl_funcs.h"
#include "sgl_window.h"

enum {
	SMP_TOOLBAR_SETSTRINGS,
	SMP_TOOLBAR_SETSTRINGS_X,
	SMP_TOOLBAR_GETSTRING,
	SMP_TOOLBAR_SHOWCLOCK,
	SMP_TOOLBAR_UNSHOWCLOCK,
	SMP_TOOLBAR_SETLOGOSTAT
	//,SMP_TOOLBAR_WNDPROC
};

#ifndef SDK_NO_PLUGIN
#define SMP_TOOLBAR_WNDPROC  MPS_CODE_SMP_TOOLBAR_PROC
#else
#define SMP_TOOLBAR_WNDPROC  SMP_Toolbar_WndProc
#endif


/**
  \defgroup smp_toolbar Simple Toolbar

  Simple toolbar will transfer the notify message to the key events:
  - Left -- softkey left up
  - Mid -- softkey select up
  - Right -- softkey right up

  To work with the simple toolbar:
  - Create the simple toolbar
  - Set the toolbar strings
  - Response to the softkey left/select/right

  \code
  	//create the toolbar
  	hToolbar = SGL_CreateWindow(SMP_Toolbar_WndProc, ...);
  	SMP_Toolbar_SetStrings(hToolbar, ...);
  	SGL_AddChildWindow(hWnd, hToolbar);

  	//response 
  	case WM_KEYUP:
  		if(MR_KEY_SOFTLEFT == wParam)
  		{
  			//left
  		}else if(MR_KEY_SELECT == wParam){
  			//mid
  		}else if(MR_KEY_SOFTRIGHT == wParam){
  			//right
  		}
  \endcode

  @ingroup controls
  @{
*/

/**
 * \brief Max support toolbar items.
 */
#define SMP_TOOLBAR_ITEMCOUNT		3

/**
 * \brief Left location of the  simple toolbar.
 */
#define SMP_TOOLBARLOC_LEFT		0

/**
 * \brief Mid location of the  simple toolbar.
 */
#define SMP_TOOLBARLOC_MID		1

/**
 * \brief Right location of the  simple toolbar.
 */
#define SMP_TOOLBARLOC_RIGHT		2

#define SMP_TOOLBARS_HAS_ROLLTXT 	0x0001L

#define SMP_TOOLBARS_HAS_NOTI 	0x0002L


#define TOOLBAR_BUTTON_WIDTH   48

	/**
	 * \name Window Member Functions
	 * @{
	 */

#if defined(INCLUDE_IN_PLUG_SGL_SRC) || defined(SDK_NO_PLUGIN)
/**
 * \brief Set toolbar strings.
 *
 * \param hWnd the toolbar handle
 * \param left the left string
 * \param mid the middle string
 * \param right the right string
 * \param redraw redraw the toolbar
 */
int32 SMP_Toolbar_ShowClock( void );
int32 SMP_Toolbar_UnShowClock( void );
int32 SMP_Toolbar_SetLogoState(int32 state);


int32 SMP_Toolbar_SetStrings(HWND hWnd, DWORD left, DWORD mid, DWORD right, BOOL redraw);

//int32 SMP_Toolbar_SetStrings_X(HWND hWnd, const char* strText, BOOL redraw);

/**
 * \brief Get the toolbar item id.
 * 
 * \param hWnd the toolbar window handle
 * \param location which item
 * \return the item id
 */
DWORD SMP_Toolbar_GetString(HWND hWnd, int location);

	/** @} */

	/**
	 * \name Window Procedure
	 * @{
	 */

/**
 * \brief The simple toolbar window procedure.
 *
 * \param hWnd the window handle
 * \param Msg the window message
 * \param wParam the first parameter
 * \param lParam the second parameter
 * \return the result of message process 
 */
LRESULT SMP_Toolbar_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
#else

/**
 * \brief Set toolbar strings.
 *
 * \param hWnd the toolbar handle
 * \param left the left string
 * \param mid the middle string
 * \param right the right string
 * \param redraw redraw the toolbar
 */
#define SMP_Toolbar_ShowClock( ) \
	mrc_extSendAppEventEx(MPS_CODE_SMP_TOOLBAR, SMP_TOOLBAR_SHOWCLOCK, (int32)0, (int32)0, (int32)0, (int32)0, (int32)0)

#define SMP_Toolbar_UnShowClock( ) \
	mrc_extSendAppEventEx(MPS_CODE_SMP_TOOLBAR, SMP_TOOLBAR_UNSHOWCLOCK, (int32)0, (int32)0, (int32)0, (int32)0, (int32)0)

#define SMP_Toolbar_SetLogoState(state) \
	mrc_extSendAppEventEx(MPS_CODE_SMP_TOOLBAR, SMP_TOOLBAR_SETLOGOSTAT, (int32)state, (int32)0, (int32)0, (int32)0, (int32)0)

/*
#define SMP_Toolbar_SetStrings_X(hWnd, strText, redraw)  \
	mrc_extSendAppEventEx(MPS_CODE_SMP_TOOLBAR, SMP_TOOLBAR_SETSTRINGS_X, (int32)hWnd, (int32)strText, (int32)redraw, (int32)0, (int32)0)
*/

#define SMP_Toolbar_SetStrings(hWnd, left, mid, right, redraw) \
	mrc_extSendAppEventEx(MPS_CODE_SMP_TOOLBAR, SMP_TOOLBAR_SETSTRINGS, (int32)hWnd, (int32)left, (int32)mid, (int32)right, (int32)redraw)

/**
 * \brief Get the toolbar item id.
 * 
 * \param hWnd the toolbar window handle
 * \param location which item
 * \return the item id
 */
#define SMP_Toolbar_GetString(hWnd, location) \
	(DWORD)mrc_extSendAppEventEx(MPS_CODE_SMP_TOOLBAR, SMP_TOOLBAR_GETSTRING, (int32)hWnd, (int32)location, (int32)0, (int32)0, (int32)0)

	/** @} */

	/**
	 * \name Window Procedure
	 * @{
	 */

/**
 * \brief The simple toolbar window procedure.
 *
 * \param hWnd the window handle
 * \param Msg the window message
 * \param wParam the first parameter
 * \param lParam the second parameter
 * \return the result of message process 
 */
#define SMP_Toolbar_WndProc(hWnd, Msg, wParam, lParam) \
	(LRESULT)mrc_extSendAppEventEx(MPS_CODE_SMP_TOOLBAR_PROC, (int32)hWnd, (int32)Msg, (int32)wParam, (int32)lParam, (int32)0, (int32)0)
#endif

	/** @} */

/** @} end of smp_toolbar */

#endif /* _SMP_TOOLBAR_H */

